home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbfaqr01.zip
/
USEKEYB.BAS
< prev
next >
Wrap
BASIC Source File
|
1992-08-09
|
920b
|
29 lines
'To use cursor keys and function keys, etc ...
DO
'Get a key from the keyboard
DO
A$ = INKEY$
LOOP UNTIL LEN(A$)
'Check if it's a extended (special) key
IF LEN(A$) = 2 THEN
'If it is then, make the key code negative
KY = -ASC(RIGHT$(A$, 1))
ELSE
'If normal (within ASCII 1 - 255 range), then make it positive
KY = ASC(A$)
END IF
'Un-comment the following line to test for keycodes
'PRINT KY 'This will give you a specific number to put into your
' SELECT CASE structure for the key you pressed
'Use SELECT CASE structure to test for keys
SELECT CASE KY
CASE 27 'ESC key pressed
EXIT DO 'bail out
'Now you can do whatever you want to the key
'CASE ..., etc ...
END SELECT
LOOP 'Infinite loop, bail out when ESC pressed (in SELECT)